﻿namespace TestApp.DataService
{
    using System.Reactive.Concurrency;
    using Contracts;
    using Microsoft.Practices.Unity;

    public sealed class DataServiceUnityContainerExtension: UnityContainerExtension
    {
        protected override void Initialize()
        {
            Container.RegisterInstance<IScheduler>(TaskPoolScheduler.Default);
            Container.RegisterType<IDataRandomizer, DataRandomizer>(new ContainerControlledLifetimeManager());
            Container.RegisterType<IDataProvider, DataProvider>(new ContainerControlledLifetimeManager());
            Container.RegisterType<IDataStore, DataStore>(new ContainerControlledLifetimeManager());
            Container.RegisterType<IDataService, DataService>(new ContainerControlledLifetimeManager());
            Container.RegisterType<IDataAggregator, DataAggregator>(new ContainerControlledLifetimeManager());
            Container.RegisterType<IDataSender, DataSender>(new TransientLifetimeManager());
            Container.RegisterType(typeof(ICallbackProvider<>), typeof(CallbackProvider<>), new ContainerControlledLifetimeManager());
            Container.RegisterType<ISimpleLogger, SimpleLogger>(new ContainerControlledLifetimeManager());
        }
    }
}
